<?php js_validate();?>
	<style media="all" >
	table.data{
		border-collapse: collapse;
		width: 100%;
	}
	table.data tr td,table.data tr th{ font-size: 11px; font-family: Arial; padding: 5px;}
	table.data tr th{background-color: #f1f1f1;}
	h3,h4{padding: 0px; margin: 0px;}
	</style>
<form action="<?php echo $own_links;?>save" id="form-validated" enctype="multipart/form-data" method="post" style="padding:10px; background-color:#FF9; margin-bottom:10px; border:2px solid #FC3;">
<input type="hidden" name="bav_id" id="bav_id" value="" />
	Cabang : 
	<?php if($this->jCfg['user']['level'] == 'cabang'){?>
			<u><b><?php echo getCabang($this->jCfg['user']['cabang']);?></b></u>
			<input type="hidden" value="<?php echo $this->jCfg['user']['cabang'];?>" name="cabang" id="cabang" />
	<?php } else {?>
    <select name="cabang" id="cabang" class="validate[required]">
    	<?php if(count($cabang['data']) > 0){
				foreach($cabang['data'] as $r){
			?>
            	<option value="<?php echo $r->cabang_id;?>"><?php echo $r->cabang_name;?></option>
            <?php 
				}
		}
		?>
    </select>
    <?php } ?>
                        
    &raquo;
    Bulan 
    <select name="bulan" id="bulan">
    	<?php for($i=1;$i<=12;$i++){?>
        	<option value="<?php echo ($i<=9)?"0".$i:$i;?>"><?php echo ($i<=9)?"0".$i:$i;?></option>
        <?php } ?>
    </select>
    <select name="tahun" id="tahun">
    	<?php for($i=date("Y");$i>=2000;$i--){?>
        	<option value="<?php echo $i;?>"><?php echo $i;?></option>
        <?php } ?>
    </select>
    &raquo;
    File <input type="file" name="excel_file" style="padding:5px;" id="excel_file" />
    
    <input type="submit" name="btnupload" class="btn-simpan" value="Upload" />
</form>
<div class="clr"></div>
<?php if(isset($data)){ ?>
<div style=" padding:4px; background-color:#FF9; border:2px solid #FC3; margin-bottom:5px; font-size:14px;">
<div style="float:left;">
<h3 style="font-size:20px;"><?php echo isset($data)?getCabang($data->bav_cabang):'';?></h3>
<h4><?php
	$b = explode("-",$data->bav_bulan);
	echo "Bulan : ".$this->bulan[$b[1]];
	echo ", Tahun : ".$b[0];

?></h4>
</div>
<div  style="float:right; width:270px; margin-top:12px;">
	<a href="<?php echo $own_links;?>hapus_data" class="btn-simpan confirm" rel="Yakin Akan menghapus data ini ?" style="padding:10px; text-decoration:none;"> Hapus Data ? </a>
    <a href="<?php echo $own_links;?>approve_data" class="btn-simpan confirm" rel="Yakin Akan Mengapprove data Ini ?" style="padding:10px; margin-left:20px; text-decoration:none;"> Approve Data ? </a>
</div>
<div class="clr"></div>
</div>
<?php } ?>

 <?php if(isset($items) && count($items) > 0){ ?>
<div style=" padding:4px; background-color:#FF9; border:2px solid #FC3; margin-bottom:5px; font-size:14px;">
<h2 style="font-size:15px; float:left;">Total Data : <?php echo count($items);?> data</h2>
<?php
	$jumlah = 0;
	foreach($items as $m){
		//$premi =  ($m->detail_uang_ptg * $m->detail_periode_ptg * $m->detail_tarif_premi)/100;
		$premi =  $m->detail_uang_ptg;
		$jumlah += $premi;
	}
?>
<h2 style="font-size:15px; float:right;">Total Uang Pertanggungan : <?php echo myNum($jumlah);?></h2>
<div class="clr"></div> 

</div>
<div class="clr"></div>
<?php } ?>

<table class="data">
	<tr>
		<th>No</th>  
        <th>Nama</th>
        <th>Alamat</th>
        <th>Tgl Akad</th>
        <th>Tgl Lahir</th>
        <th>USIA</th>
        <th>Periode Pertanggungan</th>
        <th>Uang Pertanggungan</th>
        <th>Tarif Premi (%)</th>    
        <?php if($this->bav_type == 'agunan'){?>
        	<th>Object Pertanggungan</th>
        <?php } ?>  
        <th>Premi</th>
	</tr>
    <?php if(isset($items) && count($items) > 0){
     
     
			$no=1;
                        //echo $r->detail_nama;
			foreach($items as $r){
				$premi =  ($r->detail_uang_ptg * $r->detail_periode_ptg * $r->detail_tarif_premi)/100;
		?>
     		<tr>
            	<td><?php echo $no++;?></td>
                <td><?php echo $r->detail_nama;?></td>
                <td><?php echo $r->detail_alamat;?></td>                
                <td><?php echo myDate($r->detail_tglakad,"d/m/Y",false);?></td>
                <td><?php echo myDate($r->detail_tgllahir,"d/m/Y",false);?></td>
                <td align="center"><?php echo $r->detail_usia;?> Thn</td>
                <td align="center"><?php echo $r->detail_periode_ptg;?></td>
                <td><?php echo myNum($r->detail_uang_ptg);?></td>
                <td><?php echo $r->detail_tarif_premi;?></td>
                <?php if($this->bav_type == 'agunan'){?>
                <td><?php echo $r->detail_obj_ptg;?></td>
                <?php }?>
                <td><?php echo myNum($premi);?></td>
            </tr>   
    <?php } 
	} //echo 'maaf masih dalam perbaikan database hub : reko';
	?>
</table>

